package com.sparrow.source.common.config;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.connection.Connection;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.transaction.RabbitTransactionManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.amqp.RabbitTemplateConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.io.IOException;

import static com.sparrow.source.common.RabbitConstant.PEOPLE_VERIFY_REPORT_QUEUE;

/**
 * @author bryceyung
 * @since 2024/11/27
 */
@Component
public class RabbitAutoInitConfig {
//
//    @Autowired
//    private ConnectionFactory connectionFactory;
////
//    @PostConstruct
//    public void init() {
//        try {
//            Connection connection = connectionFactory.createConnection();
//            Channel channel = connection.createChannel(Boolean.TRUE);
//            channel.exchangeDeclare("FEIYOU_BUS", ExchangeTypes.DIRECT, Boolean.TRUE);
//            channel.queueDeclare(PEOPLE_VERIFY_REPORT_QUEUE, Boolean.TRUE, Boolean.FALSE, Boolean.TRUE, null);
//            channel.queueBind(PEOPLE_VERIFY_REPORT_QUEUE, "FEIYOU_BUS", "command_invoke_result");
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//    }

}
